package com.cuit.mimall.controller.frontend;

import com.cuit.mimall.common.R;
import com.cuit.mimall.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author TeaWu
 * @folder 前台/商品分类
 */
@RestController("frontendCategoryController")
@RequestMapping("/api/v1/frontend/category")
public class CategoryController {
    private final ICategoryService categoryService;

    @Autowired
    public CategoryController(ICategoryService categoryService) {
        this.categoryService = categoryService;
    }

    /**
     * 获取所有分类
     * 前台只返回启用的分类
     *
     * @return 所有分类
     */
    @RequestMapping("/getAll")
    public R<?> getAll() {
        return categoryService.getAll();
    }


}
